package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dal.entitys.ItemDesc;
import com.mall.shopping.dto.ProductDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @Description:
 * @Author raohui
 * @Date 2021/6/19 14:39
 */
@Mapper(componentModel = "spring")
public interface ProductDetailConverter {

    @Mappings({
            @Mapping(source = "item.id",target = "productId"),
            @Mapping(source = "item.price",target = "salePrice"),
            @Mapping(source = "item.title",target = "productName"),
            @Mapping(source = "item.sellPoint",target = "subTitle"),
            @Mapping(source = "item.limitNum",target = "limitNum"),
            @Mapping(source = "item.imageBig",target = "productImageBig"),
            @Mapping(source = "itemDesc.itemDesc",target = "detail")
    })
    ProductDetailDto ProductToProductDto(Item item, ItemDesc itemDesc);

}
